#ifndef MODULE_PROGRAM_H
#define MODULE_PROGRAM_H

#include "defines.h"

#include <string.h>
#include <stdlib.h>


//Progs
#include "prog_menu.h"
#include "prog_usartmenu.h"
#include "prog_trigger.h"
#include "prog_io_debug.h"
#include "prog_manual_control.h"

#include "common_text.h"

//Define maximum allowed programs running
#define MAXPROGS 8


typedef int8_t (*InitFunction)( void );
typedef int8_t (*UninitFunction)( void );
typedef int8_t (*RunFunction)( void );


/* Structure which holds references to programs
   functions */
typedef struct
{
	char name[16];
	uint8_t writeslcd;
	InitFunction initfunc;
	UninitFunction uninitfunc;
	RunFunction runfunc;
}Program;

extern Program *_progs[];

/**
 * Define progs here. Initialize at _init function
 */
Program prog_menu, prog_trigger, prog_io_debug, prog_manual_control, prog_usartmenu;


extern int8_t module_program_init(void);
extern int8_t module_program_run(void);
extern int8_t prog_is_running(Program *);

extern int8_t add_prog(Program *);
extern int8_t remove_prog(Program *);
extern void remove_lcdwriting_progs(void);
extern void progs_running(void);

#endif
